#ifndef CRAYTRACER_H
#define CRAYTRACER_H



#include "ccamera.h"
#include "cpoint3f.h"
#include "cvector3f.h"
#include "craytracable.h"
#include "clight.h"
#include "cboundingbox.h"
#include <QImage>

class CRaytracer
{
public:
    CRaytracer();
    ~CRaytracer();

    void run(QImage *output_, unsigned nb_reflects_, unsigned montecarlo, QProgressBar * pProgressBar);
    void traceRec (CRay Ray, float coef, unsigned nb_reflects, float& r, float& g, float& b);
    void traceChannelRec (CRay Ray, float coef, unsigned nb_reflects, float& c, int channel);

    bool verif_init();

    void set_EnvironmentMaterial(CMaterial *);

    void add_objects(CRayTracable * obj);
    void remove_objects(CRayTracable * obj);
    void remove_objects(int i);
    void add_ligth(CLight * l);
    void remove_light(CLight * l);
    void remove_light(int i);

    CCamera *               m_pCamera;
    QVector<CLight *>       m_vLights;
    QVector<CRayTracable *> m_vObjects;
    CMaterial *             m_pEnvironmentMaterial;

    CBoundingBox*           m_SceneBoundingBox;
};

#endif // CRAYTRACER_H
